frame clock: fix scheduling
authorYariv Barkan <21448-yarivb@users.noreply.gitlab.gnome.org>
Wed, 10 Jun 2020 07:54:07 +0000 (10:54 +0300)
committerAlexander Larsson <alexl@redhat.com>
Mon, 15 Jun 2020 06:54:18 +0000 (08:54 +0200)
commit887aa2abdddf18d6d6e550b3f468346a0fc63119
tree64ddc8e0a8de1cf368900ff06da4bf0e897fea38
parent9c5d6eaa718ab37f91fb847a3e33dd8a91e3c1c9
frame clock: fix scheduling

Fix scheduling of the frame clock when we don't receive "frame drawn"
messages from the compositor.

If we received "frame drawn" events recently, then the "smooth frame
time" would be in sync with the vsync time. When we don't receive frame
drawn events, the "smooth frame time" is simply incremented by constant
multiples of the refresh interval. In both cases we can use this smooth
time as the basis for scheduling the next clock cycle.

By only using the "smooth frame time" as a basis we also benefit from
more consistent scheduling cadence. If, for example, we got "frame
drawn" events, then didn't receive them for a few frames, we would still
be in sync when we start receiving these events again.
gdk/gdkframeclockidle.c